import sys


# http://pybrary.net/pyPdf/pyPdf-1.13.zip
PATH_LIB_PDF = "./pyPdf-1.13/"

if not PATH_LIB_PDF in sys.path:
    sys.path.append(PATH_LIB_PDF)

from pyPdf import PdfFileWriter, PdfFileReader
inputpdf = PdfFileReader(file("340000205.pdf", "rb"))

for i in range(inputpdf.numPages // 1):
    output = PdfFileWriter()
    output.addPage(inputpdf.getPage(i * 1))
    if i * 1 + 1 <  inputpdf.numPages:
        output.addPage(inputpdf.getPage(i * 1 + 1))
    outputStream = file("./output/abc-page%s.pdf" % i, "wb")
    output.write(outputStream)
    outputStream.close()